<template>
  <div class="propertyPoint">
    <el-form :inline="true" :model="searchForm" class="demo-form-inline">
      <el-form-item label="节点层级：">
        <el-select v-model="searchForm.level">
          <el-option label="全部" :value="undefined"></el-option>
          <el-option label="一级" :value="1"></el-option>
          <el-option label="二级" :value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="是否强制：">
        <el-select v-model="searchForm.qiangzhi">
          <el-option label="全部" :value="undefined"></el-option>
          <el-option label="是" :value="1"></el-option>
          <el-option label="否" :value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="节点名称：">
        <el-input v-model="searchForm.name"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="success" @click="searchList" id="monitorEnter">查询</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="fn('add')">新增</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" border>
      <el-table-column type="index" label="序号" width="50"></el-table-column>
      <el-table-column prop="" label="节点层级"></el-table-column>
      <el-table-column prop="" label="节点名称"></el-table-column>
      <el-table-column label="是否强制">
        <template slot-scope="scope">
          {{scope.row.status == 1 ? '上架中': ''}}
          {{scope.row.status == 2 ? '待上架': ''}}
          {{scope.row.status == 3 ? '删除': ''}}
        </template>
      </el-table-column>
      <el-table-column prop="" label="附件名称"></el-table-column>
      <el-table-column label="操作时间">
        <template slot-scope="scope">
          <TimeComp :timestamp="scope.row.createTime"></TimeComp>
        </template>
      </el-table-column>
      <el-table-column prop="" label="操作人"></el-table-column>

      <el-table-column label="操作">
        <template slot-scope='scope'>
          <el-button type="text" @click="fn('edit',scope.row)" :disabled="scope.row.status === 1">编辑</el-button>
          <el-button type="text" @click="fn('delete',scope.row)" :disabled="scope.row.status === 1">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagebar">
      <el-pagination
        background
        layout="total, sizes, prev, pager, next"
        :current-page.sync="currentPage"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageSize"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :total="totalSize">
      </el-pagination>
    </div>
  </div>

</template>

<script>
  import api from '@/api/apiPath'
  export default {
    name: "propertyPoint",
    data(){
      return {
        searchForm: {
          level: undefined,
          qiangzhi: undefined,
          name: ''
        },
        tableData: []
      }
    },
    methods: {
      searchList () {

      },
      fn(type,row) {
        if (type === 'add') {

        }else if (type === 'delete') { // 删除
          this.$confirm('是否确认删除?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.axios.post(api.THEMATICPAGEOPE,{id:row.id, status: 3}).then(res => {
              this.$message.success('删除成功')
              this.searchList()
            })
          }).catch(() => {});
        }
      }
    }
  }
</script>

<style scoped>

</style>
